#!/usr/bin/python
# -*- coding: utf-8 -*-

import sys
from itertools import dropwhile, takewhile


def myprint(obj, end='\n'):
    sys.stdout.write(str(obj) + end)


def end(line):
    return not line.startswith(')')


def begin(line):
    return not line.startswith('(')


def main():
    txt = \
        '''
create table EMP
(
  empno    NUMBER(4),
  ename    VARCHAR2(10),
  job      VARCHAR2(9),
  mgr      NUMBER(4),
  hiredate DATE,
  sal      NUMBER(7,2),
  comm     NUMBER(7,2),
  deptno   NUMBER(2)
)
    '''
    lines = txt.split('\n')
    lines = takewhile(end, dropwhile(begin, lines))
    result = ','.join([x.split()[0] for x in lines if len(x.split())
                      > 1])
    myprint(result)


if __name__ == '__main__':
    main()
    myprint('done')
